<?php
/**
 * Created by ThinkPHP5.0.22.
 * User: 小涛.
 * Date: 2018/12/27.
 * Time: 22:14.
 */

namespace app\admin\model;

use think\Model;
use think\Request;

/**
 * Class NewsType 资讯类型列表
 * @package app\admin\model
 */
class NewsType extends Model
{
    //新闻类型与图片对应关系
    public function UploadLogo(){
        return $this -> belongsTo("Upload","logo","id");
    }

    //列表
    public static function listNewsType($listRow = 10){
        return self::with("UploadLogo")
            -> order("sort asc")
            -> paginate($listRow, false,[
                "query" => Request::instance() -> param()
            ]);
    }

}